package model

import (
	"github.com/kataras/iris/v12"
)

type SuccessModel struct {
	Status int `json:"status"`
	Data interface{} `json:"data"`
	Message string `json:"message"`
}

type ErrorModel struct {
	Status int `json:"status"`
	Message string `json:"message"`
}

func HandleErrorModel(ctx iris.Context, status int, msg string) {
	ctx.StatusCode(status)
	ctx.JSON(ErrorModel{
		Status: status,
		Message: msg,
	})
}

func HandleSuccessModel(ctx iris.Context, status int, data interface{}, msg string) {
	ctx.StatusCode(status)
	ctx.JSON(SuccessModel{
		Status: status,
		Data: data,
		Message: msg,
	})
}